//
//  DBJSAndHPasswordView.m
//  DBJ
//
//  Created by 肖浩然的mac on 2016/11/14.
//  Copyright © 2016年 itcast. All rights reserved.
//

#import "DBJSAndHPasswordView.h"
#import <Masonry.h>

@implementation DBJSAndHPasswordView

-(void)dbjSetupSubviews
{
    //初始子控件
//    [self setupUI];
}

//初始子控件
-(void)setupUI
{
   //1.创建原密码的图标和textFaile
    
    UIImageView *originalView = [[UIImageView alloc]init];
    //1.1设置原密码的图标
    UIImage *im = [UIImage imageNamed:@"Unknown"];
    
     originalView.image = im;
    
    originalView.contentMode = UIViewContentModeScaleAspectFit;
    
    [self addSubview:originalView];
    
    //间距
    CGFloat margin =50;
    CGFloat leftMargin = 15;
    //1.2布局设置原密码的图标
    [originalView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(self).mas_offset(margin+20);
        make.size.mas_equalTo(CGSizeMake(margin, margin));
        make.top.mas_equalTo(self).mas_offset(margin+80);
        
    }];
    
    //2创建原密码textFaile
    UITextField *originalField = [[UITextField alloc]init];
    
    //2.1设置原密码textFaile
    originalField.placeholder = @"请输入您的原密码";
    originalField.borderStyle = UITextBorderStyleRoundedRect;
    originalField.backgroundColor = [UIColor whiteColor];
    [self addSubview:originalField];
    
    //2.2原密码textFaile的布局
    [originalField mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.mas_equalTo(originalView.mas_right).offset(leftMargin);
        make.size.mas_equalTo(CGSizeMake(margin+170, 30));
        make.top.mas_equalTo(originalView).offset(10);
    }];
    //3.创建新密码的图标和textFaile
    
    UIImageView *originalView1 = [[UIImageView alloc]init];
    //3.1设置新密码的图标
    UIImage *im1 = [UIImage imageNamed:@"Unknown"];
    
    originalView1.image = im1;
    
    originalView1.contentMode = UIViewContentModeScaleAspectFit;
    
    [self addSubview:originalView1];
    

    //3.2布局设置新密码的图标
    [originalView1 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(originalView);
        make.size.mas_equalTo(CGSizeMake(margin, margin));
        make.top.mas_equalTo(originalView.mas_bottom).offset(leftMargin);
        
    }];
    
    //4创建原密码textFaile
    UITextField *originalField1 = [[UITextField alloc]init];
    
    //4.1设置原密码textFaile
    originalField1.placeholder = @"请输入您的新登录密码";
    originalField1.borderStyle = UITextBorderStyleRoundedRect;
    originalField1.backgroundColor = [UIColor whiteColor];
    [self addSubview:originalField1];
    
    //4.2新密码textFaile的布局
    [originalField1 mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.mas_equalTo(originalView1.mas_right).offset(leftMargin);
        make.size.mas_equalTo(CGSizeMake(margin+170, 30));
        make.top.mas_equalTo(originalView1).offset(10);
    }];
    //5.创建重新输入密码的图标和textFaile
    
    UIImageView *originalView2 = [[UIImageView alloc]init];
    //5.1设置新密码的图标
    UIImage *im2 = [UIImage imageNamed:@"Unknown"];
    
    originalView2.image = im2;
    
    originalView2.contentMode = UIViewContentModeScaleAspectFit;
    
    [self addSubview:originalView2];
    
    
    //5.2布局设置重新输入密码的图标
    [originalView2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(originalView1);
        make.size.mas_equalTo(CGSizeMake(margin, margin));
        make.top.mas_equalTo(originalView1.mas_bottom).offset(leftMargin);
        
    }];
    
    //6创建重新输入密码textFaile
    UITextField *originalField2 = [[UITextField alloc]init];
    
    //6.1设置重新输入密码textFaile
    originalField2.placeholder = @"请重新输入您的登录密码";
    originalField2.borderStyle = UITextBorderStyleRoundedRect;
    originalField2.backgroundColor = [UIColor whiteColor];
    [self addSubview:originalField2];
    
    //6.2重新输入密码textFaile的布局
    [originalField2 mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.mas_equalTo(originalView2.mas_right).offset(leftMargin);
        make.size.mas_equalTo(CGSizeMake(margin+170, 30));
        make.top.mas_equalTo(originalView2).offset(10);
    }];
    //7.创建完成按钮
    UIButton *successfulBtn = [[UIButton alloc]init];
    
    //7.1设置完成按钮
    [successfulBtn setTitle:@"完成" forState:UIControlStateNormal];
    
    [successfulBtn setBackgroundColor:[UIColor purpleColor]];
    
    [successfulBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    
    [self addSubview:successfulBtn];
    
    //7.2布局完成按钮
    [successfulBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.mas_equalTo(self).offset(margin+100+leftMargin);
        make.top.mas_equalTo(originalField2.mas_bottom).offset(50);
        make.size.mas_equalTo(CGSizeMake(100, 30));
        
    }];
}
@end
